package com.vhall.component.entity.room.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * RoomAuditStatusEnum-
 * 审核状态:0|待审核,-1|审核驳回,1|审核通过
 *
 * @author xing.wang
 * @date 2022/9/27
 */
@Getter
@AllArgsConstructor
public enum RoomAuditStatusEnum {
    REJECTION(-1, "审核驳回"),
    CHECK_PENDING(0, "待审核"),
    APPROVED(1, "审核通过"),

    SUBMIT_FOR_APPROVAL(9, "待送审"),
    ;
    /**
     * 审核状态
     * 0|待审核,-1|审核驳回,1|审核通过,9|待送审
     */
    private Integer auditStatus;
    /**
     * 房间审核状态的描述
     */
    private String describe;


    public static String getDescription(Integer value) {
        RoomAuditStatusEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescribe();
        }
        return StringUtils.EMPTY;
    }

    public static RoomAuditStatusEnum parse(Integer value) {
        for (RoomAuditStatusEnum anEnum : RoomAuditStatusEnum.values()) {
            if (anEnum.getAuditStatus().equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
